<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title>uiRouter路由控制器使用方式详解</title>
		<script src="../org/angular.min.js"></script>
		<script src="../org/jquery.min.js" ></script>
		<script src="../org/angular-ui-router.js" ></script>
	</head>
	<body>
		<div ng-app="hd" ng-controller="ctrl">
			<div ui-view></div>
		</div>
		<script>
			var m = angular.module('hd',['ui.router']);
			m.config(['$stateProvider','$urlRouterProvider',function($stateProvider,$urlRouterProvider){
				//默认路由
				$urlRouterProvider.otherwise('/first');
				//定义路由规则
				
				
                $stateProvider.state('firstPage',{
					url:'/first',
					templateUrl:'../link/home.html',
					controller:'ctrl'
				})
                .state('firstPage.news',{    //在这里加上firstPage.
					url:'/news',
					template:'<h1>新闻</h1>'
				})
				.state('game',{
					url:'/game',
					parent:'firstPage',
					template:'<h1>游戏</h1>'
				})
				.state('login',{
					url:'/login',
					template:'<h1>登录</h1>'
					
				})
			}])
			m.controller('ctrl',['$scope','$stateParams',function($scope,$stateParams){
				
            }]);
		</script>
	</body>
</html>

